﻿using IXION.BLOG.COMMON.DATA;
using IXION.BLOG.DOMAIN.CATALOG;
using NHibernate;
using NHibernate.Expression;
using System;
using System.Collections.Generic;
using System.Text;

namespace IXION.BLOG.DAO.CATALOG
{
    public class CatalogDao
    {
        public Catalog GetCatalogById(int id) {
            ISession session = NHibernateHelper.Instance.GetSession();
            ICriteria cr = session.CreateCriteria(typeof(Catalog));
            cr.Add(Expression.Eq("Id", id));
            IList<Catalog> catalogs = cr.List<Catalog>();
            if(catalogs.Count > 0){
                return catalogs[0];
            }
            return null;
        }
    }
}
